package vip.liux.contracts.repositories.files;

import jakarta.annotation.Nullable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.ListCrudRepository;
import org.springframework.data.repository.ListPagingAndSortingRepository;
import org.springframework.data.repository.NoRepositoryBean;
import vip.liux.contracts.models.files.FileDescriptor;
import vip.liux.contracts.shared.enums.file.FileType;

import java.util.List;

@NoRepositoryBean
public interface FileDescriptorRepository extends ListPagingAndSortingRepository<FileDescriptor, Long>, ListCrudRepository<FileDescriptor, Long> {

    FileDescriptor findByName(String name, @Nullable Long directoryId);

    List<FileDescriptor> getList(@Nullable Long directoryId, String filter, Sort sort);

    Page<FileDescriptor> getPage(@Nullable Long directoryId, FileType fileType, String filter, Pageable page);

    int countDirectoryFiles(@Nullable Long directoryId);

    long getTotalSize();

    long findByDirectoryId(Long id);
}
